//接收一个整数列表和一个整数n，返回其中所有小于n的数的平均值
object practise1 {
  def main(args: Array[String]){
    println(averageOfListBelowN(List(1, 2, 3),4))
  }
  def averageOfListBelowN(list: List[Int], n: Int): Double = {
    val filteredList = list.filter(_ < n)
    if (filteredList.isEmpty) {
      0
    } else {
      filteredList.sum.toDouble / filteredList.length.toDouble
    }

  }
}

